#!/bin/sh

# syncnow.sh
# wiSync
#
# Created by Youssef Francis on 12/19/07.
# Copyright 2007 iFrancis Development Team. All rights reserved.

echo spawn rsync -avz root@${phoneip}:"/private/var/root/${istore}/" '"'${macdir}'"' > "/Applications/wiSync/Resources/rScripts/exp_rsync1.sh"
echo expect '"password:"' >> "/Applications/wiSync/Resources/rScripts/exp_rsync1.sh"
echo send '"'${rootpass_old}"\r"'"' >> "/Applications/wiSync/Resources/rScripts/exp_rsync1.sh"
echo "expect eof" >> "/Applications/wiSync/Resources/rScripts/exp_rsync1.sh"

echo spawn rsync -avz '"'${macdir}/'"' root@${phoneip}:"/private/var/root/${istore}"  > "/Applications/wiSync/Resources/rScripts/exp_rsync2.sh"
echo expect '"password:"' >> "/Applications/wiSync/Resources/rScripts/exp_rsync2.sh"
echo send '"'${rootpass_old}"\r"'"' >> "/Applications/wiSync/Resources/rScripts/exp_rsync2.sh"
echo "expect eof" >> "/Applications/wiSync/Resources/rScripts/exp_rsync2.sh"
	
echo "expect -f '/Applications/wiSync/Resources/rScripts/exp_rsync1.sh'" > "/Applications/wiSync/Resources/rScripts/run_exp_rsync1.sh"
chmod +x "/Applications/wiSync/Resources/rScripts/exp_rsync1.sh"
chmod +x "/Applications/wiSync/Resources/rScripts/run_exp_rsync1.sh"

echo "expect -f '/Applications/wiSync/Resources/rScripts/exp_rsync2.sh'" > "/Applications/wiSync/Resources/rScripts/run_exp_rsync2.sh"
chmod +x "/Applications/wiSync/Resources/rScripts/exp_rsync2.sh"
chmod +x "/Applications/wiSync/Resources/rScripts/run_exp_rsync2.sh"